#include "StdAfx.h"
#include "PNGData.h"

namespace SpikingNeuronLib
{
	PNGData::PNGData(int numberOfLinks, array<int>^ neurons, array<int>^ firingTimes, array<int, 2>^ groupLinks)
	{
		_numberOfLinks = numberOfLinks;
		_neurons = neurons;
		_firingTimes = firingTimes;
		_groupLinks = groupLinks;
	}

	array<FiringEvent>^ PNGData::GetPNGEvents(int numberOfEvents)
	{
		// create an array of firing events for the group
		array<FiringEvent>^ group = gcnew array<FiringEvent>(numberOfEvents);
		for (int i = 0; i < numberOfEvents; i++)
		{
			FiringEvent firingEvent = FiringEvent(_firingTimes[i], _neurons[i], EventLabel::Unspecified);

			group[i] = firingEvent;
		}

		return group;
	}

	array<GroupLink>^ PNGData::GetPNGLinks()
	{
		// create an array of links for the new group
		array<GroupLink>^ links = gcnew array<GroupLink>(_numberOfLinks);
		for (int i = 0; i < _numberOfLinks; i++)
		{
			links[i] = GroupLink(_groupLinks[i, 0], _groupLinks[i, 1], _groupLinks[i, 2], _groupLinks[i, 3]);
		}

		return links;
	}
}
